#ifndef REGISTERMODULE_H
#define REGISTERMODULE_H

#include "ModuleInterface.h"
#include "utils/certificatemanager.h"
#include "utils/eccoperator.h"
#include "utils/symmetricencryption.h"
#include <string>
class registerModule : public ModuleInterface
{
    Q_OBJECT
public:
    registerModule();
    ~registerModule() override = default;
    bool initialize() override;
    QByteArray execute() override;
    bool handleReceiveData(const QByteArray &receiveData) override;
    void setPhoneNumberPasswd(const QString &phoneNumber, const QString &passwd);
    QString getResponseResult();

private:
    std::vector<unsigned char> computeSessionKey(BIGNUM *clientPriKey,
                                                 EC_POINT *peerPubKey,
                                                 unsigned char *salt);

    std::string constructRegistrationRequestMessage();

    std::string constructSafeRegistrationRequestMessage(const std::string &data);

private:
    std::string clientCert_PEM;
    ECCOperator m_ecc;
    std::vector<unsigned char> sessionKey_vector;
    QString m_phoneNumber;
    QString m_passwd;
    SymmetricEncryption m_symm;
    std::string response_result;
};

#endif // REGISTERMODULE_H
